package cn.com.KnowNews.service.imlp;

import cn.com.KnowNews.dao.daoImpl.NewsDaoImpl;
import cn.com.KnowNews.entity.News;
import cn.com.KnowNews.service.INewsService;

import java.util.List;

public class NewsServiceImpl implements INewsService {
    @Override
    public List<News> showAllNews() throws Exception {
        NewsDaoImpl newsDao = new NewsDaoImpl();
        return newsDao.showAllNews();
    }

    @Override
    public boolean addNew(News news) throws Exception {
        NewsDaoImpl newsDao = new NewsDaoImpl();
        return newsDao.addNew(news);
    }

    @Override
    public int delNew(int id) throws Exception {
        NewsDaoImpl newsDao = new NewsDaoImpl();
        return newsDao.delNew(id);
    }

    @Override
    public int UpDateNews(News news) throws Exception {
        NewsDaoImpl newsDao = new NewsDaoImpl();
        return newsDao.UpDateNews(news);
    }

    @Override
    public News showNews(int id) throws Exception {
        NewsDaoImpl newsDao = new NewsDaoImpl();
        return newsDao.showNews(id);
    }

    @Override
    public List<News> selectByCate(String cate) throws Exception {
        NewsDaoImpl newsDao = new NewsDaoImpl();
        return newsDao.selectByCate(cate);
    }

}
